<?php
use yii\helpers\Html;
use yii\web\View;
use yii\widgets\ActiveForm;
use yii\widgets\Breadcrumbs;
use app\modules\core\models\Validator;
use app\modules\core\widgets\SlideNav;

$this->title = '安装验证器';

$formOptions = [
    'options' => ['class' => 'form-horizontal'],
    'method'        => 'POST',
    'fieldConfig'   => [
            'labelOptions'  => ['class' => 'col-md-1 control-label'],
            'template'      => '{label}<div class="col-md-3 controls">{input}</div>{hint}{error}',
        ],
    ];
?>
    <div class="container-fluid">
	<div class="row">
        <?= SlideNav::widget() ?>

		<div class="col-sm-9 col-sm-offset-3 col-md-10 col-md-offset-2 col-lg-10 col-lg-offset-2 main">
            <?= Breadcrumbs::widget([
                'homeLink' => ['label' => 'HOME', 'url' => '/core'],
                'links' => [
                    ['label' => '验证器', 'url' => '/core/validator/list'],
                    '安装',
                ]
            ]) ?>
			
			<div class="row">
				<div class="col-md-12 col-lg-12">
					<div class="alert alert-warning" role="alert">
						 <button type="button" class="close" data-dismiss="alert">×</button>
						 <strong>警告!</strong> 请注意你的个人隐私安全.
					</div>
                        
                    <div>
                       <!-- Nav tabs -->
                       <ul class="nav nav-tabs" role="tablist">
                           <li role="presentation" class="active"><a href="#home" aria-controls="home" role="tab" data-toggle="tab">内建验证器</a></li>
                           <li role="presentation"><a href="#profile" aria-controls="profile" role="tab" data-toggle="tab">自定义验证器</a></li>
                       </ul>
                    
                       <!-- Tab panes -->
                       <div class="tab-content">
                           <div role="tabpanel" class="tab-pane panel panel-default active" id="home">
                               <div class="panel-body">
                                    <?php $form1 = ActiveForm::begin($formOptions); ?>
                                    <input type="hidden" name="isBuiltIn" value="1" />
                                    <?= $form1->field($validator, 'id')->textInput() ?>
                                    <?= $form1->field($validator, 'name')->textInput() ?>
                                    <?= $form1->field($validator, 'desc')->textInput() ?>
                                    <?= $form1->field($validator, 'ns')->dropDownList(Validator::getCoreValidators())->label('验证器') ?>
                                    <?= $form1->field($validator, 'params')->textInput(['placeholder' => '{"key": "value"}']) ?>
                                    <?= '<button type="submit" class="btn btn-primary">安装</button>' ?>
                                    <?php ActiveForm::end(); ?>
                               </div>
                           </div>
                           <div role="tabpanel" class="tab-pane panel panel-default " id="profile">
                               <div class="panel-body">
                                    <?php $form2 = ActiveForm::begin($formOptions); ?>
                                    <input type="hidden" name="isBuiltIn" value="0" />
                                    <?= $form2->field($validator, 'id')->textInput() ?>
                                    <?= $form2->field($validator, 'name')->textInput() ?>
                                    <?= $form2->field($validator, 'desc')->textInput() ?>
                                    <?= $form2->field($validator, 'ns')->textInput() ?>
                                    <?= $form2->field($validator, 'params')->textInput(['placeholder' => '{"key": "value"}']) ?>
                                    <?= '<button type="submit" class="btn btn-primary">安装</button>' ?>
                                    <?php ActiveForm::end(); ?>
                               </div>
                               </div>
                           </div>
                       </div>
                    </div>
				</div>
			</div>
		</div>
	</div>
</div>

